public class Test {
    public static void main(String[] args) {
        String s1="hello";
        String s2="i";
        System.out.println(s1.compareTo(s2));//'h'-'i'=-1
        String s3="hello";
        String s4="helloworld";
        System.out.println(s3.compareTo(s4));//字符串s3的长度减去字符串s4的长度
    }
}
